package com.zigong.app.beans;

import android.support.annotation.NonNull;
import android.text.TextUtils;

import com.ruihang.generalibrary.ui.util.IListData;
import com.ruihang.generalibrary.utils.IDataDate;
import com.zigong.app.ui.util.IListShowData;

import org.xutils.db.annotation.Column;
import org.xutils.db.annotation.Table;

import java.io.Serializable;
import java.sql.Date;

/**
 * Created by Administrator on 2017/7/3 0003.
 */
@Table(name = "FHistory")
public class FHistory implements IListShowData, Serializable, IDataDate {
    private static final long serialVersionUID = 4224226616934156461L;
    @Column(name = "newsId", autoGen = false, isId = true)
    protected String newsId;
    @Column(name = "isLiving")
    protected boolean isLiving;
    @Column(name = "newsImage")
    protected String newsImage;
    @Column(name = "newsMediaLength")
    protected String newsMediaLength;
    @Column(name = "newsTitle")
    protected String newsTitle;
    @Column(name = "newsType")
    protected int newsType;
    @Column(name = "newsUrl")
    protected String newsUrl;
    @Column(name = "pubTime")
    protected String pubTime;
    @Column(name = "skipType")
    protected String skipType;
    @Column(name = "lable")
    protected String lable;
    @Column(name = "historyTime")
    protected long historyTime;
    protected Date pubTimeTemp;

    /**
     * 是否为焦点新闻
     */
    protected boolean isFocusNews;

    public boolean isLiving() {
        return isLiving;
    }

    public void setLiving(boolean living) {
        isLiving = living;
    }

    public String getNewsId() {
        return newsId;
    }

    public void setNewsId(String newsId) {
        this.newsId = newsId;
    }

    public String getNewsImage() {
        return newsImage;
    }

    public void setNewsImage(String newsImage) {
        this.newsImage = newsImage;
    }

    public String getNewsMediaLength() {
        return newsMediaLength;
    }

    public void setNewsMediaLength(String newsMediaLength) {
        this.newsMediaLength = newsMediaLength;
    }

    public String getNewsTitle() {
        return newsTitle;
    }

    public void setNewsTitle(String newsTitle) {
        this.newsTitle = newsTitle;
    }

    public int getNewsType() {
        return newsType;
    }

    public void setNewsType(int newsType) {
        this.newsType = newsType;
    }

    public String getNewsUrl() {
        return newsUrl;
    }

    public void setNewsUrl(String newsUrl) {
        this.newsUrl = newsUrl;
    }

    public String getPubTime() {
        return pubTime;
    }

    public void setPubTime(String pubTime) {
        if (!TextUtils.equals(pubTime, this.pubTime)) {
            pubTimeTemp = null;
        }
        this.pubTime = pubTime;
    }

    public String getSkipType() {
        return skipType;
    }

    public void setSkipType(String skipType) {
        this.skipType = skipType;
    }

    public boolean isFocusNews() {
        return isFocusNews;
    }

    public void setFocusNews(boolean focusNews) {
        isFocusNews = focusNews;
    }

    public String getLable() {
        return lable;
    }

    public void setLable(String lable) {
        this.lable = lable;
    }

    public Date getPubTimeTemp() {
        return pubTimeTemp;
    }

    public void setPubTimeTemp(Date pubTimeTemp) {
        this.pubTimeTemp = pubTimeTemp;
    }

    @Override
    public String getDataTitle() {
        return newsTitle;
    }

    @Override
    public String getDataImg() {
        return newsImage;
    }

    @Override
    public String getDataTag() {
        return lable;
    }

    @Override
    public String getDataId() {
        return newsId;
    }

    @Override
    public int getDataType() {
        return 0;
    }

    @Override
    public int getDataViewType() {
        return newsType;
    }

    @Override
    public IListData getOwner() {
        return null;
    }

    @Override
    public String getTime() {
        return null;
    }

    @Override
    public IListShowData getOwenerData() {
        return null;
    }

    @Override
    public Date getDataDate() {
        return pubTimeTemp;
    }

    @Override
    public void setDataDate(Date date) {
    }

    @NonNull
    @Override
    public String getDatePattern() {
        return "yyyy-MM-dd HH:mm:ss";
    }

    @Override
    public String getDateString() {
        return pubTime;
    }

    public long getHistoryTime() {

        return historyTime;
    }

    public void setHistoryTime(long historyTime) {
        this.historyTime = historyTime;
    }

    @Override
    public String toString() {
        return "FHistory{" +
                "newsId='" + newsId + '\'' +
                ", isLiving=" + isLiving +
                ", newsImage='" + newsImage + '\'' +
                ", newsMediaLength='" + newsMediaLength + '\'' +
                ", newsTitle='" + newsTitle + '\'' +
                ", newsType=" + newsType +
                ", newsUrl='" + newsUrl + '\'' +
                ", pubTime='" + pubTime + '\'' +
                ", skipType='" + skipType + '\'' +
                ", historyTime=" + historyTime +
                ", pubTimeTemp=" + pubTimeTemp +
                ", isFocusNews=" + isFocusNews +
                ", lable='" + lable + '\'' +
                '}';
    }
}
